#include "student.h"
#include <cstring>
#include <cctype>

bool Student::setSid(int id) {
    if (id >= 1 && id <= 1000) {
        ljt_sid = id;
        return true;
    }
    return false;
}

bool Student::setSname(const char* name) {
    if (name && strlen(name) > 0) {
        strncpy(ljt_sname, name, 49);
        ljt_sname[49] = '\0';
        return true;
    }
    return false;
}

bool Student::setSage(int age) {
    if (age >= 1 && age <= 120) {
        ljt_sage = age;
        return true;
    }
    return false;
}

bool Student::setSsex(char sex) {
    sex = std::toupper(sex);
    if (sex == 'M' || sex == 'F') {
        ljt_ssex = sex;
        return true;
    }
    return false;
}

int Student::getSid() const {
    return ljt_sid;
}

const char* Student::getSname() const {
    return ljt_sname;
}

int Student::getSage() const {
    return ljt_sage;
}

char Student::getSsex() const {
    return ljt_ssex;
}